<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
            "http://www.w3.org/TR/REC-html40/loose.dtd">
<HTML>
<HEAD>



<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<META name="GENERATOR" content="hevea 1.08">
<LINK rel="stylesheet" type="text/css" href="umsroot.css">
<TITLE>
Basics
</TITLE>
</HEAD>
<BODY >
<A HREF="umsroot037.html"><IMG SRC ="contents_motif.gif" ALT="Up"></A>
<A HREF="umsroot039.html"><IMG SRC ="next_motif.gif" ALT="Next"></A>
<HR>

<H2 CLASS="section"><A NAME="htoc86">7.1</A>&nbsp;&nbsp;Basics</H2><UL>
<LI><A HREF="umsroot038.html#toc50">Purpose of Modules</A>
<LI><A HREF="umsroot038.html#toc51">What is under Visibility Control?</A>
<LI><A HREF="umsroot038.html#toc52">What Modules are There?</A>
</UL>

<A NAME="toc50"></A>
<H3 CLASS="subsection"><A NAME="htoc87">7.1.1</A>&nbsp;&nbsp;Purpose of Modules</H3>

The purpose of the module system is to provide a way to package
a piece of code in such a way that
<UL CLASS="itemize"><LI CLASS="li-itemize">
internals are hidden
<LI CLASS="li-itemize">it has a clearly defined interface
<LI CLASS="li-itemize">naming conflicts are avoided
</UL>
In particular, this helps with
<UL CLASS="itemize"><LI CLASS="li-itemize">
Structuring of large applications:
 Modules should be used to break application programs into
 natural components and to define the interfaces between them.
<LI CLASS="li-itemize">Provision of libraries:
 All ECL<SUP><I>i</I></SUP>PS<SUP><I>e</I></SUP> libraries are modules. Their interfaces are
 defined in terms of what the module makes visible to the world.
<LI CLASS="li-itemize">Different implementations of the same predicate:
 In constraint programming it is quite common to have different
 implementations of a constraint, which all have the same declarative
 meaning but different operational behaviour (e.g. different amount of
 propagation, using different algorithms, exhibiting different
 performance characteristics). The module system supports that by
 allowing to specify easily which version(s) of a predicate should
 be used in a particular context.
</UL>
<A NAME="toc51"></A>
<H3 CLASS="subsection"><A NAME="htoc88">7.1.2</A>&nbsp;&nbsp;What is under Visibility Control?</H3>

The ECL<SUP><I>i</I></SUP>PS<SUP><I>e</I></SUP> module system governs the visibility of the following
entities:
<DL CLASS="description" COMPACT=compact><DT CLASS="dt-description">
<B>Predicate names</B><DD CLASS="dd-description">
 Predicates can always be used in the module where they are defined
 and optionally in other modules when they are made available.
<DT CLASS="dt-description"><B>Structure names</B><DD CLASS="dd-description">
<A NAME="@default307"></A>
 Structure declarations can be valid only local to a module or
 shared between several modules.
<DT CLASS="dt-description"><B>Syntax settings</B><DD CLASS="dd-description">
<A NAME="@default308"></A>
 These include operator declarations
 <A HREF="../bips/kernel/syntax/op-3.html"><B>op/3</B></A><A NAME="@default309"></A>,
 syntax options and
 character classes.
 This means in particular that different modules can use different
 language dialects (e.g. ECL<SUP><I>i</I></SUP>PS<SUP><I>e</I></SUP> vs. ISO-Prolog).
<DT CLASS="dt-description"><B>Container names</B><DD CLASS="dd-description">
<A NAME="@default310"></A>
 These include the names of record keys, nonlogical variables and references.
 They are always local to the module where they are declared.
<DT CLASS="dt-description"><B>Initialization and Finalization goals</B><DD CLASS="dd-description">
 Modules can have initialization and finalization goals attached,
 see section <A HREF="umsroot041.html#initfini">7.4.3</A>.
</DL>
Note that every definition (predicate, structure etc) is in some module,
<A NAME="@default311"></A>
there is no space outside the modules. When you don't explicitly
specify a module, you inherit the module from the context in which
you do an operation. When you are using an interactive ECL<SUP><I>i</I></SUP>PS<SUP><I>e</I></SUP>
toplevel, a prompt will tell you in which module your input is
read and interpreted.<BR>
<BR>
<A NAME="toc52"></A>
<H3 CLASS="subsection"><A NAME="htoc89">7.1.3</A>&nbsp;&nbsp;What Modules are There?</H3>

The module system is flat, i.e. no module is part of another module, 
and module names must be unique. There are
<UL CLASS="itemize"><LI CLASS="li-itemize">
a few basic modules that are part of the ECL<SUP><I>i</I></SUP>PS<SUP><I>e</I></SUP> runtime
 <A NAME="@default312"></A>
	system and are always there. The most important one is
	called <TT>eclipse_language</TT> and is by default imported
	into all other modules.
<LI CLASS="li-itemize">the library modules: every library consists of at least one
 <A NAME="@default313"></A>
	module. By convention, that module name is the library name
	and same as the base part of the library filename.
<LI CLASS="li-itemize">the application-defined modules: these are created by the
	application programmer.
<LI CLASS="li-itemize">in an interactive ECL<SUP><I>i</I></SUP>PS<SUP><I>e</I></SUP> toplevel there is one module
 <A NAME="@default314"></A>
	in which queries entered by the user are read and executed.
	That module name is displayed in a prompt.
</UL>
<HR>
<A HREF="umsroot037.html"><IMG SRC ="contents_motif.gif" ALT="Up"></A>
<A HREF="umsroot039.html"><IMG SRC ="next_motif.gif" ALT="Next"></A>
</BODY>
</HTML>
